<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">

<meta charset="utf-8" />
<title></title>

<meta name="description" content="overview & stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="static/css/bootstrap.min.css" rel="stylesheet" />
<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link rel="stylesheet" href="static/css/font-awesome.min.css" />
<link rel="stylesheet" href="static/css/chosen.css" />

<link rel="stylesheet" href="static/css/ace.min.css" />
<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
<link rel="stylesheet" href="static/css/ace-skins.min.css" />

<link rel="stylesheet" href="static/css/datepicker.css" />
<!-- 日期框 -->

<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>



<!--提示框-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(function(){
	//初始化省
	showAddressTree("province",{});
	
	$("#province").chosen().change(function(value){
		//清空市
		$("#city").empty();
        //清空县
		$("#county").empty();
		$("#county").trigger("liszt:updated");
        $("#county").chosen();
	
		//初始化市
		var value = $("#province").val();
		if(value.length > 0) {
			showAddressTree("city",{id:value});
		}
	});
	
	function showAddressTree(id, param){
		$.post('<%=basePath%>city/cityTree.do',param,function(resp){
			var blank = "";
			if("province" == id) {
				blank = "选择省";
			}else if("city" == id){
				blank = "选择市";
			}else {
				blank = "选择县";
			}
			$("#" + id).append("<option value=''>" + blank + "</option>");
			if("success" == resp.result) {
				$.each(resp.data, function(i, item) {
					var option = "<option value='" + item.id + "'>" + item.text + "</option>";
					$("#" + id).append(option);
				});
				$("#" + id).trigger("liszt:updated");
            	$("#" + id).chosen();
			}
		},"json")
	}
	
	$("#city").chosen().change(function(value){
        //清空市
		$("#county").empty();
	
		//初始化县
		var value = $("#city").val();
		if(value.length > 0) {
			showAddressTree("county",{id:value});
		}
	});
})
	
	//保存
	function save(){

		
		if($("#companycode").val()==""){

			$("#companycode").tips({
				side:3,
	            msg:'输入公司简码',
	            bg:'#AE81FF',
	            time:2
	        });
			
			$("#companycode").focus();
			return false;
		}
		if($("#companyname").val()==""){
			
			$("#companyname").tips({
				side:3,
	            msg:'输入公司名称',
	            bg:'#AE81FF',
	            time:2
	        });
			
			$("#companyname").focus();
			return false;
		}
		if($("#linkman").val()==""){
					
					$("#linkman").tips({
						side:3,
			            msg:'输入公司运营者',
			            bg:'#AE81FF',
			            time:2
			        });
					
					$("#linkman").focus();
					return false;
		}
		if($("#mobile").val()==""){
			
			$("#mobile").tips({
				side:3,
		        msg:'输入公司运营者',
		        bg:'#AE81FF',
		        time:2
		    });
			
			$("#mobile").focus();
			return false;
		}
		$("#Form").submit();
		$("#zhongxin").hide();
		$("#zhongxin2").show();
	}
	
	
</script>
</head>
<body>
	<form action="usercompany/${msg }.do" name="Form" id="Form" method="post">
		<input type="hidden" name="id" id="id" value="${pd.id }" />
		<div id="zhongxin">
			<table id="table_report"
				class="table table-striped table-bordered table-hover">


				<tr>
					<td>公司简码:</td>
					<td><input type="text" style="width: 80%;" name="companycode"
						id="companycode" value="${pd.company_code }" placeholder="这里输入简码"
						title="简码" /></td>
				</tr>
				<tr>
					<td>公司名称:</td>
					<td><input type="text" style="width: 80%;" name="companyname"
						id="companyname" value="${pd.company_name }" placeholder="这里输入名称"
						title="名称" /></td>
				</tr>
				<tr>
					<td>公司简拼:</td>
					<td><input type="text" style="width: 80%;" name="companypiny"
						id="companypiny" value="${pd.company_piny }"
						placeholder="这里输入简拼（首字母），未填则由系统生成" title="简拼" /></td>
				</tr>
				<tr>
					<td>公司运营者:</td>
					<td><input type="text" style="width: 80%;" name="linkman"
						id="linkman" value="${pd.linkman }" placeholder="这里输入公司运营者"
						title="运营者" /></td>
				</tr>
				<tr>
					<td>公司电话:</td>
					<td><input type="text" style="width: 80%;" name="mobile"
						id="mobile" value="${pd.mobile }" placeholder="这里输入公司电话"
						title="电话" maxlength=11
						onkeypress="var k=event.keyCode; return k>=48&&k<=57"
						onpaste="return !clipboardData.getData('text').match(/\D/)"
						ondragenter="return false" /></td>
				</tr>
				<tr>
					<td>公司邮箱:</td>
					<td><input type="text" style="width: 80%;" name="email"
						id="email" value="${pd.email }" placeholder="这里输入公司邮箱" title="邮箱" /></td>
				</tr>
				<tr>
					<td>公司地址:</td>
				 	<td>
							<select
									class="chzn-select" id="province" name="province" value="${pd.sheng}" data-placeholder="选择省"
									style="vertical-align: top; width: 23%;">
								</select>
								<select
									class="chzn-select" id="city" name="city" value="${pd.shi}" data-placeholder="选择市"
									style="vertical-align: top; width: 23%;">
								</select>
								<select
									class="chzn-select" id="county" name="county" value="${pd.qu}" data-placeholder="选择县"
									style="vertical-align: top; width: 23%;">
								</select>
								<input type="text" style="width: 80%;"
						name="companyaddress" id="companyaddress"
						value="${pd.company_address }" placeholder="这里输入详细地址" title="地址" />
								</td>
				</tr>
				<tr>
					<td>公司介绍:</td>
					<td id="nr"><textarea style="width: 80%; height: 220px"
							name="introduce" id="introduce">${pd.introduce }</textarea></td>
				</tr>
				<tr>
					<td class="center" colspan="2"><a
						class="btn btn-mini btn-primary" onclick="save();">保存</a> <a
						class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					</td>
				</tr>
			</table>
		</div>

		<div id="zhongxin2" class="center" style="display: none">
			<br /> <br /> <br /> <br /> <br /> <img
				src="static/images/jiazai.gif" /><br />
			<h4 class="lighter block green">提交中...</h4>
		</div>

	</form>


	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/ace-elements.min.js"></script>
	<script src="static/js/ace.min.js"></script>
	<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
	<!-- 单选框 -->
	<script type="text/javascript"
		src="static/js/bootstrap-datepicker.min.js"></script>
	<!-- 日期框 -->

	<!-- 编辑框-->
	<script type="text/javascript" charset="utf-8">window.UEDITOR_HOME_URL = "<%=path%>
		/plugins/ueditor/";
	</script>
	<script type="text/javascript" charset="utf-8"
		src="plugins/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="plugins/ueditor/ueditor.all.js"></script>
	<!-- 编辑框-->
	<script type="text/javascript">
		$(top.hangge());
		$(function() {

			//单选框
			$(".chzn-select").chosen();
			$(".chzn-select-deselect").chosen({
				allow_single_deselect : true
			});

			//日期框
			$('.date-picker').datepicker();

		});
		function reurl() {
			UE.getEditor('introduce');
		}
		setTimeout('reurl()', 500);
	</script>

</body>
</html>